<template>
  <div class="list w">
    <div class="header">
        <i class="el-icon-s-home"></i>
        <span style="color:#e9a539">地产列表</span>
      </div>
    <div class="propertyCard" v-for="item in propertyList" :key="item.id" @click="$router.push(`/detail/${item.id}`)">
      <div class="left">
        <img :src="item.image" alt="" />
      </div>
      <div class="line"></div>
      <div class="right">
        <h2>{{ item.title }}</h2>
        <p v-html='item.content'></p>
      </div>
    </div>
  </div>
</template>

<script>
import { getPropertiesList } from "@/api/categories";
export default {
  data() {
    return {
      propertyList: [],
      title_contains: this.$route.query.val ? this.$route.query.val : ""
    };
  },
  async created() {
    console.log(this.title_contains,28);
    if (this.title_contains) {
      const { data } = await getPropertiesList({
        title_contains:this.title_contains
      });
      this.propertyList = data;
      console.log(data,32);
    } else {
       const { data } = await getPropertiesList();
        this.propertyList = data;
        console.log(data,36);
    }
  },
  methods:{
  }
};
</script>

<style lang="less" scoped>
.w{
    width: 50vw;
}
.header {
      margin: 1vw 0;
      span {
        // font-weight: bold;
        font-size: 1.5vw;
      }
    }
    .el-icon-s-home {
      color:#e9a539 ;
      font-size: 1.5vw;
         margin-right: 0.26vw;
    }
.propertyCard {
background-color: rgba(255, 255, 255, 0.418);
    padding: 0 0.417vw;
  display: flex;
  
  height: 10.417vw;
  // background-color: skyblue;

  border: 0.052vw solid #ccc;
  margin: 0 auto;
  margin-bottom: 0.521vw;
  box-shadow: 0 0 0 0 #000;
//   border-radius: 0.26vw;

  transition: .3s;
 &:hover{
    box-shadow: 0.104vw 0.156vw 0.208vw 0.156vw #08c1e949;
    // border-radius: 0.26vw;
  }
  .line {
    display: block;
    content: "";
    height: 90%;
    border-right: 0.104vw solid #ccc;
    margin-top: 0.521vw;
    margin-left: 1.563vw;
  }
  .left {
    height: 100%;
    width: 20%;
    // background-color: tomato;
    img {
      display: block;
      width: 9.896vw;
      height: 9.896vw;
      margin: 0.26vw auto;
      object-fit: cover;
    }
  }
  .right {
    height: 100%;
    width: 80%;
    // background-color: red;
    text-align: center;
    padding: 0 0.521vw;
  }
}
</style>